import { get, post, del, patch ,put} from '../../utils/request';

export function settlement() {
    // POST /rest/api/v6.0/cart/settlement
    return post(`/cart/settlement`);
}

export function coupon(obj) {
    // PGET /rest/api/v6.0/cart/available/coupon
    return get(`cart/available/coupon`, obj);
}

export function addressAll() {
    //GET /rest/api/v6.0/address/all
    return get(`address`);
}

export function addressItem(obj) {
    //GET /rest/api/v6.0/address/all
    return get(`address/${obj.id}`);
}

export function delAddressApi(obj) {
    return del(`/address/${obj.id}`);
}

export function saveAddressApi(obj) {
    //POST /rest/api/v6.0/address
    return post(`address`, obj);
}

export function edtAddressApi(obj) {
    //POST /rest/api/v6.0/address
    return put(`address/${obj.id}`);
}

export function freightApi(obj) {
    //GET /rest/api/v6.0/cart/freight
    return get(`cart/freight`, obj);
}

export function payPriceApi(obj) {
    //GET /rest/api/v6.0/cart/price
    return get(`cart/price`, obj);
}

export function invoiceApi(obj) {
    //GET /rest/api/v6.0/invoice
    return post(`invoice`, obj);
}


export function addrAndSelf(obj) {
    // GET /rest/api/v6.0/address/addr/and/self
    return get(`address/addr/and/self`, obj);
}

// Lz 提交订单。。。。
export function submitOrder(obj) {
    return post(`order`, obj);
}
//获取店铺优惠券
export function getCounponApi() {
    return post(`/cart/settlement`);
}

//获取 发票信息
export function getInVoiceApi(obj) {
    console.log('getInVoiceApi', obj);
    return get('/invoice/basic', obj);
}

export function getOneInVoiceApi(obj) {
    return get('/invoice/basic', obj);
}
//更改订单配置。。。
export function updateOrder(obj) {
    return post('/cart/configuration', obj);
}
